home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / mxutil / tspak17 / dac_init.asm < prev    next >
Assembly Source File  |  1994-07-13  |  1KB  |  69 lines

  1. ; DAC_INIT.ASM
  2. ;
  3. ; External assembler subroutine for Recwav.pas, initializes the DAC chip.
  4. ;
  5.  
  6. CODE        SEGMENT    BYTE PUBLIC
  7.         ASSUME    CS:CODE,DS:CODE
  8.         PUBLIC    DAC_INIT
  9. DAC_INIT    PROC    NEAR
  10.         JMP    START
  11.         ;
  12.         ; Local data.
  13.         ;
  14. SOUNDHALTED    DB    0    ; flag, 1 when Int 1Ah function complete
  15. INT15OLD    DD    0    ; default vector for Int 15h
  16.         ;
  17.         ; Temporary Int 15h handler.
  18.         ;
  19. INT15NEW:    CMP    AX,91FBh
  20.         JE    >L0
  21.         JMP    DWORD PTR CS:INT15OLD
  22. L0:        MOV    CS:SOUNDHALTED,1
  23.         IRET
  24.         ;
  25.         ; Body of the procedure.  DS addresses code segment.
  26.         ;
  27. START:        PUSH    DS
  28.         MOV    AX,CS
  29.         MOV    DS,AX
  30.         ;
  31.         ; Save the default Int 15h vector.
  32.         ;
  33.         MOV    AX,3515h
  34.         INT    21h
  35.         MOV    WORD PTR INT15OLD,BX
  36.         MOV    WORD PTR INT15OLD+2,ES
  37.         ;
  38.         ; Use the new Int 15h handler now.
  39.         ;
  40.         MOV    DX,OFFSET INT15NEW
  41.         MOV    AX,2515h
  42.         INT    21h
  43.         ;
  44.         ; Prepare the sound chip.  (Mr. Terry's code.)
  45.         ;
  46.         MOV    SOUNDHALTED,0
  47. L1:        MOV    AH,84h
  48.         INT    1Ah
  49. L2:        MOV    AH,81h
  50.         INT    1Ah
  51.         JC    L2
  52.         CMP    SOUNDHALTED,0
  53.         JE    L1
  54.         ;
  55.         ; Restore the default Int 15h vector.
  56.         ;
  57.         MOV    DX,WORD PTR INT15OLD
  58.         MOV    DS,WORD PTR INT15OLD+2
  59.         MOV    AX,2515h
  60.         INT    21h
  61.         ;
  62.         ; Restore DS and exit.
  63.         ;
  64.         POP    DS
  65.         RET
  66. DAC_INIT    ENDP
  67. CODE        ENDS
  68.         END
  69.